<template>
    <div>
        <h5>vuex-子组件1</h5>
        <p>vuex的数据展示</p>
        <!-- <p>{{ $store.state }}</p> -->
        <p>{{ $store.state.msg }} => <input v-model="$store.state.msg" type="text" /> </p>
        <p>{{ $store.state.num }} => <input v-model="num" type="text" /> </p>
        <p>{{ $store.state.arr }} => <input type="button" value="异步数据加载（计时器模拟）" @click="$store.dispatch('initArr',{ name:'vuexChildOne' })"> </p>
        <p>{{ $store.state.user }}</p>
    </div>
</template>

<script>
    export default {
        computed:{
            num:{
                get(){
                    return this.$store.state.num;
                },
                set(nv){
                    this.$store.commit("setNum",nv)
                }
            }
        }
    }
</script>

<style lang="scss" scoped>

</style>